package com.tencent.iov.cowin.befsale.clue.controller.cus;

import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.request.QueryClueCustomerCollectAllRequest;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueCustomerCollectResponse;
import com.tencent.iov.cowin.befsale.clue.controller.cus.vo.request.QueryCustomerFollowRecordRequest;
import com.tencent.iov.cowin.befsale.clue.controller.cus.vo.response.CustomerFollowRecordResponse;
import com.tencent.iov.cowin.befsale.clue.service.cus.CustomerFollowRecordService;
import com.tencent.iov.cowin.befsale.clue.service.cus.CustomerService;
import com.software.boot.common.entity.Response;
import com.software.boot.common.model.dao.PageRequest;
import com.software.boot.common.model.dao.PageResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Describe: 总部管理_Controller层
 * @author: xiamu
 * @created: 2021-12-21 18:37:29
 * @version: 1.0
 */
@RestController
@RequestMapping(value = "/v1/bef/sale/oemManage", produces = MediaType.APPLICATION_JSON_VALUE)
@Api(tags = "总部管理_Controller层")
public class OemManageController {

    @Autowired
    private CustomerFollowRecordService customerFollowRecordService;
    @Autowired
    private CustomerService customerService;

    /**
     * 通过参数获取跟进历史信息
     *
     * @param: request 查询参数
     * @return: 跟进记录结果
     */
    @ApiOperation(value = "总部管理-通过参数获取跟进历史信息", httpMethod = "POST", response = Response.class, notes = "get_follow_list_by_param")
    @PostMapping(path = "/get_follow_list_by_param")
    public Response<List<CustomerFollowRecordResponse>> getFollowListByParam(@ApiParam(required = true, value = "对象信息") @RequestBody QueryCustomerFollowRecordRequest request) {
        return Response.success(customerFollowRecordService.getListByParam(request));
    }
    /**
     * 总部管理-线索宽表列表查询
     *
     * @param: request 分页参数
     * @return: 线索宽表数据
     */
    @ApiOperation(value = "总部管理-线索宽表列表查询", httpMethod = "POST", response = Response.class, notes = "get_page_list_by_param")
    @PostMapping(path = "/get_page_list_by_param")
    public Response<PageResponse<ClueCustomerCollectResponse>> getManageCluePageListByParam(@ApiParam(required = true, value = "对象信息") @RequestBody PageRequest<QueryClueCustomerCollectAllRequest> request) {
        return Response.success(customerService.getManagePageListByParam(request));
    }

    /**
     * 总部管理-导出
     *
     * @param: request 参数
     * @return: excel
     */
    @ApiOperation(value = "总部管理-线索宽表列表查询", httpMethod = "POST", response = Response.class, notes = "export_excel")
    @PostMapping(path = "/export_excel")
    public Response<String> exportClueCollectAndFollowList(@ApiParam(required = true, value = "对象信息") @RequestBody PageRequest<QueryClueCustomerCollectAllRequest> request) {
        return Response.success(customerService.exportClueCollectAndFollowList(request));
    }
}